<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>密码修改页面</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script src="http://how2j.cn/study/js/jquery/2.0.0/jquery.min.js"></script>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.validate.js"></script>
  </head>
  
  <body>
  
  <form  id="Studentschange" name="Studentschange" action="student/Cpassword" >
    	
   		<input class="form-control" type="password" name="ypassword" placeholder="原密码"/><br>
  		<input class="form-control" type="password" id="xpassword1" name="xpassword1" placeholder="新密码" /><br>
		<input class="form-control" type="password" id="xpassword2" name="xpassword2" placeholder="再次输入密码" /><br>
  		<input type="submit" class="btn btn-primary" value="修改" >
  		
    </form>
    <script language="javascript">
    
    var error='${error}';
    if(error.length>0){
    if(error==("login")){
    window.open("<%=path%>/login.jsp",'_top');
    }else{
    alert(error);
    }
    }
         //验证成功后，触发事件
  $.validator.setDefaults({
    submitHandler: function() {
      alert("确定修改!");
       //window.open("student/Cpassword",'_top');
       from.submit();
    }
});
//表单验证
  $().ready(function() {
  $("#Studentschange").validate({
  rules:{
  	ypassword:{
  	required:true,
  	minlength:6
  	},
  	xpassword1:{
  	required:true,
  	minlength:6
  	},
  	xpassword2:{
  	required:true,
  	minlength:6,
  	equalTo:"#xpassword1"
  	}
  },
  messages:{
  	ypassword:{
  		required:"请输入密码",
  		minlength:"密码太短"
  	},
  	xpassword1:{
		 required:"请输入密码",
		 minlength:"密码太短"	
  	},
  	xpassword2:{
  		required:"请输入密码"	,
  		minlength:"密码太短",
  		equalTo:"两次输入密码不同"
  	}
  }
  
  });
  });
      </script>
  </body>
</html>
